package file;

import java.io.File;

//向控制台输出file包中所有子项的名字和空间大小
public class Test2 {
    public static void main(String[] args) {
        File dir = new File("./src/file");
        File[] subs = dir.listFiles();
        if (dir.isDirectory()) {
            for (int i = 0; i < subs.length; i++) {
                File sub = subs[i];
                System.out.println(sub.getName() + "," + sub.length()+"字节");
            }
        }









    }
}